
<?php 





	//$outstr = check_constraints($tb, $fd);
/*
 * 
 * CREATE TABLE `portal` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8_bin NOT NULL,
  `url` varchar(255) COLLATE utf8_bin NOT NULL,
  `OneColor` varchar(8) COLLATE utf8_bin NOT NULL,
  `TwoColor` varchar(8) COLLATE utf8_bin NOT NULL,
  `ThreeColor` varchar(8) COLLATE utf8_bin NOT NULL,
  `defaultLang` int(10) NOT NULL DEFAULT '1',
  `sitelogo_ar_file` int(10) DEFAULT NULL,
  `sitelogo_lt_file` int(10) DEFAULT NULL,
  `background_file` int(10) DEFAULT NULL,
  `sitelogo_ar_file_ext` int(10) NOT NULL DEFAULT '2',
  `sitelogo_lt_file_ext` int(10) NOT NULL DEFAULT '2',
  `background_file_ext` int(10) NOT NULL DEFAULT '2',
  `repeatBackground` varchar(10) COLLATE utf8_bin NOT NULL DEFAULT 'repeat',
  `fontLtId` int(10) NOT NULL,
  `fontArId` int(10) NOT NULL,
  `googleAnalytics` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `addDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `description` varchar(500) COLLATE utf8_bin DEFAULT NULL,
  `keywords` varchar(500) COLLATE utf8_bin DEFAULT NULL,
  `isFree` varchar(1) COLLATE utf8_bin NOT NULL DEFAULT 'N',
  `active` varchar(1) COLLATE utf8_bin NOT NULL DEFAULT 'N',
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`),
  KEY `fontLtId` (`fontLtId`,`fontArId`) USING BTREE,
  KEY `fontArId` (`fontArId`) USING BTREE,
  KEY `defaultLang` (`defaultLang`) USING BTREE,
  CONSTRAINT `portal_ibfk_1` FOREIGN KEY (`fontLtId`) REFERENCES `portal_fonts` (`id`),
  CONSTRAINT `portal_ibfk_2` FOREIGN KEY (`fontArId`) REFERENCES `portal_fonts` (`id`),
  CONSTRAINT `portal_ibfk_3` FOREIGN KEY (`defaultLang`) REFERENCES `portal_languages` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COLLATE=utf8_bin
 * */
if (false){
$GLOBALS["conn"]->BeginTrans();

//ew_LoadRecordset("TRUNCATE TABLE portal_tables_fields");
echo "<br/>";

$Sql ="SELECT
DISTINCT information_schema.`TABLES`.TABLE_NAME as tablename
FROM
information_schema.`TABLES` ,
portal_portal_app,
 portal_app where
information_schema.`TABLES`.TABLE_SCHEMA = DATABASE() and portal_app.id = portal_portal_app.appId and
information_schema.`TABLES`.TABLE_NAME  like concat('%', portal_app.`name`, '%')";

$rstables=$GLOBALS["conn"]->Execute($Sql);


while (!$rstables->EOF)  {
	$table=$rstables->fields[0];
	
	
		refreshTable($table);
$rstables->MoveNext();
}

$GLOBALS["conn"]->CommitTrans();
}

for ($i=0;$i<6;$i++){
moveColumn("table",7+$i,3+$i);
}
//check table order

if (getParameter("filter") && strpos(getParameter("filter"),"objectId=")!==false){
$filter=preg_split("/objectId=/", getParameter("filter"))[1];
//echo "okok";
checkAndResetOrder("portal_tables_fields","objectId",$filter);
	
	
}




?>



<a href="?table=<?=getObjByKey("portal_objects","name","id",getParameter("objectId"))?>&filter=1">Back to <?=getObjByKey("portal_objects","lib_".$LANG,"id",getParameter("objectId"))?></a><br/>